<script setup lang="ts">
import { Modal, ModalProps } from "ant-design-vue"
import { computed } from "vue"

export type Props = ModalProps

const props = defineProps<Props>()

const model = defineModel<Props["open"]>()

const computedProps = computed<Omit<Props, "open">>(() => {
  const result = { ...props } as Props
  delete result.open
  delete result["onUpdate:open"]
  return result
})

const slots = defineSlots<InstanceType<typeof Modal>["$slots"]>()
</script>

<template>
  <Modal v-model:open="model" v-bind="computedProps">
    <template v-for="(_, key) in slots" :key="key" #[key]="params">
      <slot :key="key" :name="key" v-bind="params"></slot>
    </template>
  </Modal>
</template>
